{extend name='admin@public/content'}

{block name="button"}

<!--{if auth("$classuri/add")}-->
<button data-open='{:url("$classuri/add")}' data-title="添加" class='layui-btn layui-btn-sm'>添加</button>
<!--{/if}-->

{if auth("$classuri/del")}
<button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-danger'>批量删除</button>
{/if}

{/block}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">项目ID</label>
        <div class="layui-input-inline">
            <input name="id" value="{$Think.get.id}" placeholder="请输入项目ID" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">项目名称</label>
        <div class="layui-input-inline">
            <input name="item" value="{$Think.get.item}" placeholder="请输入项目名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
            <input name="sub_item" value="{$Think.get.sub_item}" placeholder="请输入姓名" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input name="phone" value="{$Think.get.phone}" placeholder="请输入手机号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <select name="status" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ['-1'=>"审核不通过",'0'=>"待审核",'1'=>"已通过",'2'=>"已锁定"] as $k=>$v}-->
                {if $Think.get.status eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">报名方式</label>
        <div class="layui-input-inline">
            <select name="reg_status" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ['0'=>"前台",'1'=>"后台"] as $k=>$v}-->
                {if $Think.get.reg_status eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">视频</label>
        <div class="layui-input-inline">
            <select name="video_status" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ['0'=>"未传",'1'=>"已传"] as $k=>$v}-->
                {if $Think.get.video_status eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <!--{if !empty($cates)}-->
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">赛区分类</label>
        <div class="layui-input-inline">
            <select name="cate_id" id="cate_id" lay-search lay-filter="cate_id">
                <option value="">所有</option>
                {foreach $cates as $cate}
                <!--{if $Think.get.cate_id eq $cate.cate_id}-->
                <option selected="selected" value="{$cate.cate_id}">{$cate.name}</option>
                <!--{else}-->
                <option value="{$cate.cate_id}">{$cate.name}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->

    <!--{if !empty($jxs_list)}-->
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">经销商分类</label>
        <div class="layui-input-inline">
            <select name="sub_cate_id" id="sub_cate_id" lay-search lay-filter="sub_cate_id">
                <option value="">所有</option>
                {foreach $jxs_list as $cate}
                <!--{if $Think.get.sub_cate_id eq $cate.cate_id}-->
                <option selected="selected" value="{$cate.cate_id}">{$cate.name}</option>
                <!--{else}-->
                <option value="{$cate.cate_id}">{$cate.name}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->


    <!--{if !empty($province_list)}-->
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">省份分类</label>
        <div class="layui-input-inline">
            <select name="province_id" id="province_id" lay-search lay-filter="province_id">
                <option value="">所有</option>
                {foreach $province_list as $pro}
                <!--{if $Think.get.province_id eq $pro.province_id}-->
                <option selected="selected" value="{$pro.province_id}">{$pro.name}</option>
                <!--{else}-->
                <option value="{$pro.province_id}">{$pro.name}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">城市分类</label>
        <div class="layui-input-inline">
            <select name="city_id" id="city_id" lay-filter="city_id">
                <option value="">所有</option>
                {foreach $city_list as $city}
                <!--{if $Think.get.city_id eq $city.city_id}-->
                <option selected="selected" value="{$city.city_id}">{$city.name}</option>
                <!--{else}-->
                <option value="{$city.city_id}">{$city.name}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">商超系统</label>
        <div class="layui-input-inline">
            <input name="sub_item2" value="{$Think.get.sub_item2}" placeholder="请输入商超系统" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">门店</label>
        <div class="layui-input-inline">
            <input name="address" value="{$Think.get.address}" placeholder="请输入门店" class="layui-input">
        </div>
    </div>

    <script src="__STATIC__/plugs/layui/layui.all.js"></script>


    <script type="text/javascript">
        layui.use(['layer', 'form'],
            function() {
                var layer = layui.layer
                    ,form = layui.form;

                //监听省份选择
                form.on('select(province_id)',
                    function(data) {
                        $('#city_id').html('<option value="">所有</option>');
                        $.ajax({
                            url: "{:url('admin/info/get_city')}",
                            data: {
                                province_id: data.value
                            },
                            type: 'POST',
                            dataType: 'json',
                            success: function(data1) {
                                $("#city_id").append(data1);
                                form.render('select'); //刷新select选择框渲染
                            }
                        });
                    });


            });

    </script>

    <!--{if !empty($sources)}-->
    <!--<div class="layui-form-item layui-inline">
        <label class="layui-form-label">渠道分类</label>
        <div class="layui-input-inline">
            <select name="source" lay-search>
                <option value="">所有</option>
                {foreach $sources as $source}
                &lt;!&ndash;{if $Think.get.source eq $source.tag}&ndash;&gt;
                <option selected="selected" value="{$source.tag}">{$source.name}</option>
                &lt;!&ndash;{else}&ndash;&gt;
                <option value="{$source.tag}">{$source.name}</option>
                &lt;!&ndash;{/if}&ndash;&gt;
                {/foreach}
            </select>
        </div>
    </div>-->
    <!--{/if}-->


    <!--<div class="layui-form-item layui-inline">
        <label class="layui-form-label">是否饮用</label>
        <div class="layui-input-inline">
            <select name="is_use" class="layui-select">
                <option value="">所有</option>
                {foreach ['1'=>"经常饮用",'2'=>"有时饮用",'3'=>"较少饮用",'4'=>"未饮用"] as $k=>$v}
                {if $Think.get.is_use eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                {/foreach}
            </select>
        </div>
    </div>-->

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-inline">
            <input name="addtime" id="create_at" value="{$Think.get.addtime}" placeholder="请选择创建时间" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
    <!--{if auth("$classuri/outItems")}-->
    <div class="layui-form-item layui-inline">
        <button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="outOrders"><i class="layui-icon">&#xe601;</i> 导 出Excel</button>
    </div>
    <!--{/if}-->
</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});

    //监听提交
    form.on('submit(outOrders)', function(data){
        params = data.field;
        layer.confirm('确认要导出吗？',function(){
            loading = layer.load(2, {
                shade: [0.2,'#000']
            })
            var url = "{:url('admin/info/outItems')}";
            DownLoad({ //调用下载方法
                url:url,data:params
            });
            layer.closeAll(); //关闭所有层

        });
    });

    /*通用下载导出*/
    function DownLoad(options) {
        var config = $.extend(true, { method: 'post' }, options);
        var $iframe = $('<iframe id="down-file-iframe" />');
        var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
        $form.attr('action', config.url);
        for (var key in config.data) {
            $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
        }
        $iframe.append($form);
        $(document.body).append($iframe);
        $form[0].submit();
        $iframe.remove();
    }
</script>
<!-- 表单搜索 结束 -->
<style>
    .asc{
        display: inline-block;
        font-size: 10px;
        cursor: pointer;
        padding-left: 10px;
    }
    .desc{
        display: inline-block;
        font-size: 10px;
        cursor: pointer;
        margin-left: 10px;
    }
</style>
<form onsubmit="return false;" data-auto="true" method="post">
    <!--{if empty($list)}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table notevent" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td'>
                <input data-auto-none="none" data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-xs">排 序</button>
            </th>
            <th class="nowrap">项目ID</th>
            <th class="nowrap">项目名称</th>
            <th class="nowrap">姓名</th>
            <th class="nowrap">报名方式</th>
            <th class="nowrap">赛区</th>
            <th class="nowrap">商超系统</th>
            <th class="nowrap">电话</th>
            <th class="nowrap"><a target="_self" href='/#/info/lists.html?spm=m-46-98-99'>票数</a> <span class="asc"><a target="_self" href='/#/info/lists.html?spm=m-46-98-99&sort_by_vcount=asc'>↑</a></span><span class="desc"><a target="_self" href='/#/info/lists.html?spm=m-46-98-99&sort_by_vcount=desc'>↓</a></span></th>
            <!--<th class="nowrap">渠道</th>-->
            <th class="nowrap">视频</th>
            <th class="text-left">发布时间 / 状态</th>
            <th class='text-center'></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td text-top'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='list-table-sort-td text-top'>
                <input name="_{$vo.id}" value="{$vo.sort}" class="list-sort-input">
            </td>
            <td class='list-table-sort-td text-top'>
                {$vo.id}
            </td>
            <td class="text-left nowrap text-top">
                <!--<img class="headimg" width="40px" height="40px" src="{$vo.small_pic|default=''}" >-->
                <img class="headimg" width="40px" height="40px" src="{$vo.startpicurl|default=''}" >
                {:subtext($vo.item,6)}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.sub_item}
            </td>
            <td class="text-left nowrap text-top">
                {if empty($vo.wechat_id)} 后台报名{else}前台{/if}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.cate_name}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.sub_item2}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.phone}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.vcount}
            </td>
            <!--<td class="text-left nowrap text-top">
                {$vo.source_name}
            </td>-->
            <td class="text-left nowrap text-top">
                {if !empty($vo.videourl)}<font color="green">已传</font>
                {else}<font color="#f4a460">未传</font>
                {/if}
            </td>
            <td class='text-left nowrap text-top'>
                {:date('Y-m-d H:i:s',$vo.addtime)}
            </td>

            <td class='text-center nowrap text-top'>

                <!--{if auth("$classuri/edit")}-->
                <span class="text-explode">|</span>
                <a data-open='{:url("$classuri/edit")}?id={$vo.id}'>编辑</a>
                <!--{/if}-->

                <span class="text-explode">|</span>
                <a data-title="查看详情" data-modal='{:url("$classuri/detail")}?id={$vo.id}'>详情</a>

                <!--{if auth("$classuri/del")}-->
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='delete' data-action='{:url("$classuri/del")}'>删除</a>
                <!--{/if}-->

                <!--{if $vo.status <> 0 and auth("$classuri/afresh")}-->
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='status' data-value='0' data-action='{:url("$classuri/afresh")}'>打回重审</a>
                <!--{/if}-->

                <!--{if $vo.status eq 0 and auth("$classuri/check")}-->
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='status' data-value='1' data-action='{:url("$classuri/check")}'><span style="color: red">审核通过</span></a>
                <!--{/if}-->

                <!--{if $vo.status eq 0 and auth("$classuri/operate")}-->
                <span class="text-explode">|</span>
                <a data-title="操作" data-modal='{:url("$classuri/operate")}?id={$vo.id}'><span style="color: red">审核不通过</span></a>
                <!--{/if}-->

                <!--{if $vo.status eq -1}-->
                <span class="text-explode">| 审核不通过</span>
                <!--{/if}-->

                <!--{if $vo.status eq 1 and auth("$classuri/clock")}-->
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='status' data-value='2' data-action='{:url("$classuri/clock")}'>锁定</a>
                <!--{/if}-->

                <!--{if $vo.status eq 2 and auth("$classuri/clock")}-->
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='status' data-value='1' data-action='{:url("$classuri/clock")}'><font color="red">解锁</font></a>
                <!--{/if}-->

                <!--{if auth("$classuri/edit")}-->
                <br>
                <span class="text-explode">|</span>
                <a href='/#/vote_record/lists.html?item_id={$vo.id}' target="_blank">投票流水</a>
                <span class="text-explode">|</span>
                <a data-title="投票汇总" data-modal="/vote_record/ticket_detail.html?spm=m-46-98-110&id={$vo.id}" >投票汇总</a>
                <!--{/if}-->

                <!--{if auth("$classuri/deduct")}-->
                <span class="text-explode">|</span>
                <a data-title="扣除票数" data-modal='{:url("$classuri/deduct")}?id={$vo.id}'>扣票</a>
                <!--{/if}-->

                <!--{if auth("$classuri/raise")}-->
                <!--<span class="text-explode">|</span>-->
                <!--<a data-title="增加票数" data-modal='{:url("$classuri/raise")}?id={$vo.id}'>增票</a>-->
                <!--{/if}-->

                <!--{if auth("$classuri/ticket")}-->
                <!--<span class="text-explode">|</span>-->
                <!--<a data-title="自动投票" data-modal='{:url("$classuri/ticket")}?id={$vo.id}'>-->
                    <!--{if $vo.is_auto_ticket eq 1}-->
                    <!--<font color="blue">自动投票中</font>-->
                    <!--{else}-->
                    <!--自动投票-->
                    <!--{/if}-->
                <!--</a>-->
                <!--{/if}-->

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/if}-->
</form>
<script>
    (function () {
        window.form.render();
        window.laydate.render({range: true, elem: '#create_at'});
    })();
</script>
<style>
    .headimg {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        margin-right: 10px;
    }

</style>
{/block}